package test;

import java.sql.*;

import com.mchange.v2.c3p0.ComboPooledDataSource;

public class C3p0LinkMysql {
	public static void main(String[] args) {
		System.out.println(">>>> ");
		try {
			ComboPooledDataSource cpds = new ComboPooledDataSource();
			cpds.setDriverClass("com.mysql.jdbc.Driver");
			cpds.setJdbcUrl("jdbc:mysql://127.0.0.1:3306/account");
			cpds.setUser("root");
			cpds.setPassword("1");
			cpds.setMaxStatements(180);
			cpds.setMaxPoolSize(100);
			
			Connection con = null;
			Statement stmt = null;
			ResultSet rs = null;
			con = cpds.getConnection();
			stmt = con.createStatement();
			rs = stmt.executeQuery("select * from t_user");
			while (rs.next()) {
				System.out.println(	 rs.getString("id")+"---id");
				System.out.println(	 rs.getString("name")+"---name");
			}
			
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}
